class SecurityController < ApplicationController
  layout  'standard'

  def login
    case request.method
      when :post
        if session['employee'] = Employee.authenticate(params['employee_login'], params['employee_password'])

          flash['notice']  = "Login successful"
          redirect_back_or_default :controller=>"/home", :action => "index"
        else
          @login    = params['employee_login']
          @message  = "Login unsuccessful"
      end
    end
  end
  
  def delete
    if params['id'] and session['employee']
      @employee = employee.find(@params['id'])
      @employee.destroy
    end
    redirect_back_or_default :action => "welcome"
  end  
    
  def logout
    session['employee'] = nil
  end
    
  def welcome
  end
  
end
